//
//  EditTutorialViewController.m
//  TutorialsModule
//
//  Created by Augusto Guido on 29/09/09.
//  Copyright 2009 Moove-IT. All rights reserved.
//

#import "EditTutorialViewController.h"


@implementation EditTutorialViewController

@synthesize myNavigationItem;



- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo
{
    [imageButton setBackgroundImage:image forState:UIControlStateNormal];
    [self dismissModalViewControllerAnimated:YES];
}

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
    [self dismissModalViewControllerAnimated:YES];    
}


- (IBAction)cancel {
	
	[self dismissModalViewControllerAnimated:YES];
    
}

- (IBAction)changeImage {
	UIActionSheet *actionSheet = [[[UIActionSheet alloc] initWithTitle:@"Select an image" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"From library", @"Take new one", nil] autorelease];
	actionSheet.actionSheetStyle = UIActionSheetStyleBlackTranslucent;
	[actionSheet showInView:self.view];
}

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
	/*if (buttonIndex < 2){
		UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
	//	imagePickerController.allowsEditing = YES;
		if (buttonIndex == 0)
			[imagePickerController setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
		if (buttonIndex == 1)
			if ( [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
				[imagePickerController setSourceType:UIImagePickerControllerSourceTypeCamera];
		imagePickerController.delegate = self;		
		[self presentModalViewController:imagePickerController animated:YES];		
		[imagePickerController release];
	}*/	
}

- (IBAction)save {
	[self dismissModalViewControllerAnimated:YES];    
}

 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
		self.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
        // Custom initialization
    }
    return self;
}

/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
}
*/


// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    //return (interfaceOrientation != UIInterfaceOrientationPortrait);
	return YES;
}


- (void)didReceiveMemoryWarning {
	// Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
	
	// Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
	// Release any retained subviews of the main view.
	// e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}


@end
